#ifndef _PRODUCT_TEST_UART_COMMON_H_
#define _PRODUCT_TEST_UART_COMMON_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <termios.h>
#include <errno.h>
#include <string.h>
#include <pthread.h>
#include <signal.h>
#include "OSC_cJSON.h"
#include "InCommon.h"
#include "ProductTestUartRead.h"
#include "ProductTestCommon.h"
#include "ProductTestSpk.h"

#define LESS_THAN_FEED_TIME     5 //minute
#define FEED_LIST_MAX_NUM       8
#define MCU_VERSION_LEN         64

typedef enum
{
    COMMAND_MANUL_FEED                      = 0x01,
    COMMAND_DEVIVE_RESET                    = 0x09,
    COMMAND_RECORD_MODE                     = 0x0d,
    COMMAND_ABNORMAL_INFO                   = 0x05,
    COMMAND_SYNC_TIME                       = 0x06,
    COMMAND_FEED_RESULT                     = 0x07,
    COMMAND_CHECK_BLE_VERSION               = 0x08,
    COMMAND_GET_TIME                        = 0x09,
    COMMAND_FEED_REMIND                     = 0x0c,
    COMMAND_MCU_WARNING_LED                 = 0x11,
    COMMAND_SEND_DEV_NET_STATUS             = 0x19,
    COMMAND_OPEN_MCU_TEST_LED               = 0x20,
    COMMAND_GET_BLE_MAC                     = 0x26,
    COMMAND_NETWORK_MODE                    = 0x21,
    COMMAND_CAT_CLOSE_TIME                  = 0x2e,
    COMMAND_XIAO_AN_CUSTOM_FEED_RESULT      = 0x2f,
}EUartCommandType;

typedef enum
{
    RESULT_DEVICE_BAD                       = 0x01,
    RESULT_NO_FOOD                          = 0x02,
    RESULT_BLOCKING_FOOD                    = 0x04,
    RESULT_FOOD_RUN_OUT                     = 0x08,
}EFeedFailedResult;

Com_u8 Ext_ProductTest_Uart_Get_Feed_Flag(void);
void Ext_ProductTest_Uart_Set_Feed_Flag(Com_u8 flag);
Com_u8 Ext_ProductTest_Uart_Get_FeedResult(void);
void Ext_ProductTest_Uart_Set_FeedResult(Com_u8 res);
Com_ps8 Ext_ProductTest_Uart_Result(void);
Com_ps8 Ext_ProductTest_Uart_Get_Version(void);
void Ext_ProductTest_Uart_Init(void);

#ifdef __cplusplus
}
#endif

#endif
